package org.greatstorm.dao.impl;

import java.util.List;

import org.greatstorm.dao.GeneralDao;
import org.greatstorm.dao.ReplyDao;
import org.greatstorm.entity.EntityObject;
import org.greatstorm.entity.Reply;
import org.greatstorm.util.Filter;
import org.greatstorm.util.Operator;

import com.google.inject.Singleton;

@Singleton
public class ReplyDaoImpl extends GeneralDao implements ReplyDao {

	@Override
	protected String getEntityName() {
		return Reply.KIND;
	}

	@Override
	public List<EntityObject> getReplyListByArticleKey(String key) {
		Filter f1 = new Filter();
		f1.setKey(Reply.ARTICLE_PK);
		f1.setOpt(Operator.OPT_EQUAL);
		f1.setValue(key);

		List<EntityObject> list = this.getEntityListByFilter(f1);

		return list;
	}

	@Override
	public List<EntityObject> getReplesByArticleKey(String key) {
		Filter f = new Filter();
		f.setKey(Reply.ARTICLE_PK);
		f.setOpt(Operator.OPT_EQUAL);
		f.setValue(key);

		List<EntityObject> list = this.getEntityListByFilter(f);

		return list;
	}

}
